package cn.stacey.elasticsearch.dao;

import java.util.List;

import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

import cn.stacey.elasticsearch.domain.Product;

public interface ProductDao extends ElasticsearchRepository<Product, Integer>{
	//根据商品名称查询
	//new TermQuery(new Term("name","java"))
	//名字只能写findBy**(必须在domain中有此属性)
	List<Product> findByName(String name);
	
	//根据分类名称查
	List<Product> findByCategory(String category);
	
	//根据商品名称和分类搜索
	List<Product> findByNameAndCategory(String name,String category);
	
	//根据商品名字或分类搜索
	List<Product> findByNameOrCategory(String name,String category);
	
	//根据价格区间搜索
	List<Product> findByPriceBetween(double min,double max);
	
	//模糊查询
	List<Product> findByNameLike(String name);
	
}
